<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>公司管理</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=39cd89cd">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .table > tbody > tr > td {
            height: 35px;
            max-height: 44px;
            overflow: hidden;
        }

        .td-value span.lineOne {
            overflow: hidden;
            text-overflow: ellipsis;
            color: black !important;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }

        .td-value {
            text-align: left !important;
            vertical-align: middle;
            word-wrap: break-word;
            color: black !important;
        }

        .td-value span {
            display: inline-block;
            overflow: hidden;
            padding-left: 0.06rem;
            word-wrap: break-word;
            color: black !important;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            background-color: #d3e8fd;
            padding: 0.08rem 0.06rem;
            border: 0.01rem solid #e8e8ea;
            display: none;
            overflow: hidden;
        }

        .table > thead > tr > th {
            background-color: #d3e8fd !important;
        }

        .div-td-content-more i {
            width: 0.15rem;
            height: 0.12rem;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 0.5rem;
            top: -.12rem;
        }

    </style>
</head>
<body>
<div class="div-td-content-more" style="width: 100%;"><i></i></div>
<section class="content" id="app" v-cloak>
    <!--<div style="height: 25px;margin-bottom: 10px;">-->
    <!--<input class="form-control pull-left input-sm" type="text"-->
    <!--placeholder="公司名字关键字"-->
    <!--style="width: 120px;margin-left: 10px;"-->
    <!--v-model="companyNameKey"/>-->
    <!--<button type="button" class="btn oaBtn btn-sm pull-left" style="margin-left: 10px;" @click="getList">查询</button>-->
    <!--&lt;!&ndash;<button type="button" class="btn oaBtn pull-right btn-sm"&ndash;&gt;-->
    <!--&lt;!&ndash;style="margin-right: 20px"&ndash;&gt;-->
    <!--&lt;!&ndash;@click="goDetail(0,'add')"/>&ndash;&gt;-->
    <!--&lt;!&ndash;新增申请</button>&ndash;&gt;-->

    <!--<div class="clearfix"></div>-->
    <!--&lt;!&ndash; /.box-tools &ndash;&gt;-->
    <!--</div>-->
    <div class="box-body no-padding iframeH2" style="overflow: auto;" id="scrollDiv">
        <div id="progress" class="wyui-progress"></div>
        <table class="table table-hover text-center table-striped">
            <thead>
            <tr>
                <!--<th style="width:20px;">-->
                <!--<input type="checkbox" id="checkAll" v-model="isCheckedAll"-->
                <!--v-if="pageType=='pay'"/>-->
                <!--</th>-->
                <th style="width: 40px;">序号</th>
                <!--<th>合同类型</th>-->
                <th style="width: 110px;">公司简称</th>
                <th style="width: 180px;">公司全称</th>
                <th style="width: 110px;">公司电话</th>
                <th style="width: 60px;">省会</th>
                <th style="width: 150px;">税号</th>
                <!--                <th style="width: 60px;">代理品牌</th>-->
                <th style="width: 200px;">可售品牌</th>
                <th>公司地址</th>
                <th style="width: 120px;">操作</th>
            </tr>
            </thead>
            <tbody id="tbList">
            <tr v-for="(item,i) in list">
                <td>{{i+1}}</td>
                <td><a href="javascript:void(0);" @click="goDetail(item.id,'browser')">{{item.name}}</a></td>
                <td class="td-value"><span class="lineOne"
                                           style="text-align: center !important;">{{item.allName}}</span></td>
                <td>{{item.fixedTelephone}}</td>
                <td>{{item.provincialCapital}}</td>
                <td>{{item.taxId}}</td>
                <!--                <td>{{item.brand}}</td>-->
                <td><span style="text-align: center;">{{item.availableBrands}}</span></td>
                <td class="td-value"><span class="lineOne">{{item.address}}</span></td>
                <td>
                    <a href="javascript:void(0);" @click="goDetail(item.id,'edit')">&nbsp;编辑&nbsp;</a>
                    <!--<a href="javascript:void(0);" @click="del(item.id)">&nbsp;删除&nbsp;</a>-->
                    <a href="javascript:void(0);" @click="goDetail(item.id,'addBrands')">&nbsp;可售品牌&nbsp;</a>
                </td>
            </tr>
            </tbody>
        </table>
        <!--<div class="oa-pager text-center" style="margin-top: 5px;">-->
        <!--共-->
        <!--<span id="allCount"> 0 </span>条记录&nbsp;&nbsp;&nbsp;-->
        <!--<span id="nowPage"> 1 </span>/<span id="allPage">1</span>&nbsp;&nbsp;&nbsp;-->
        <!--<span class="oa-pager-button" id="first">首页</span>-->
        <!--<span class="oa-pager-button" id="prev">上一页</span>-->
        <!--<span class="oa-pager-button" id="next">下一页</span>-->
        <!--<span class="oa-pager-button" id="last">尾页</span>-->
        <!--</div>-->
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=558d0414"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="/dist/plugins/select2/select2.full.min.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript">
    $(function () {
        $("body").on("click", ".td-value", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }

        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });

</script>
<script type="text/javascript">

    function refresh() {
        $.wyui.page.getByPage();
    }

    var app = new Vue({
        el: '#app',
        data: {
            currentUser: getCurrentUser(),
            companyNameKey: '',
            list: [],
            id: ''
        },

        methods: {
            goDetail: function (id, btnName) {
                if (btnName == 'browser') {
                    var H = $(window).height() - 50;
                    top.$.dialog({
                        content: 'url:/page/company/detail.html?id=' + id + '&pageType=browser',
                        title: '公司信息查询',
                        width: 420,
                        height: 500,
                        max: true,
                        min: true,
                        lock: true
                    });
                }
                if (btnName == 'add') {
                    var H = $(window).height() - 50;
                    top.$.dialog({
                        content: 'url:/page/company/detail.html?pageType=add',
                        title: '公司信息添加',
                        width: 420,
                        height: 500,
                        max: true,
                        min: true,
                        lock: true
                    });
                }
                if (btnName == 'edit') {
                    var H = $(window).height() - 50;
                    top.$.dialog({
                        content: 'url:/page/company/detail.html?id=' + id + '&pageType=edit',
                        title: '公司信息修改',
                        width: 420,
                        height: 500,
                        max: true,
                        min: true,
                        lock: true
                    });
                }
                if (btnName == 'addBrands') {
                    var H = $(window).height() - 50;
                    top.$.dialog({
                        content: 'url:/page/company/addBrands.html?id=' + id,
                        title: '可售品牌配置',
                        width: 288,
                        height: 180,
                        max: true,
                        min: true,
                        lock: true
                    });
                }

            },
            del: function (id) {
                var that = this;
                var r = confirm("请确认是否删除");
                if (r == true) {
                    $.wyui.postMethod('/company/deleteById.json', {id: id}, function (r) {
                        that.company = r;
                        console.log(r.isOk)
                        if (r.isOk) {
                            alert("删除成功")
                            this.refresh();
                        } else {
                            alert("删除失败")
                        }
                    });
                }
            },
            getList: function (e) {
                var that = this;
                $.extend($.wyui.page.queryParams, {companyNameKey: that.companyNameKey});
                $.wyui.page.getByPage();

            }
        },
        mounted: function () {

        }
    });
    //分页
    $.wyui.page.dataUrl = server.ip + "/company/getCompanyListByPage.json";
    $.extend({});
    $.wyui.page.getByPage_callback = function (records) {
        console.log(records)
        app.list = records;
        document.getElementById("scrollDiv").scrollTop = 0;
    };
    $.wyui.page.getByPage_scroll_callback = function (list) {
        if (list.length < 30) {
            isLoad = false;
        } else {
            for (var i = 0; i < list.length; i++) {
                app.list.push(list[i]);
            }
            isLoad = true;
        }
    };
</script>
</body>
</html>